<template>
  <h3>子组件--父组件传递过来的钱---{{ money }}</h3>
  <button @click="useMoney(100)">使用父组件的钱</button>
</template>

<script>
export default {
  emits: ['change-money'],
  props: {
    money: {
      type: Number,
      default: 100,
    },
  },
  setup(props, { emit }) {
    const useMoney = (val) => {
      const leftMoney = props.money - val;
      emit('change-money', leftMoney);
    };
    return { useMoney };
  },
};
</script>
